<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //预定义类：\d ==>[0-9],\D ==>[^0-9],
        //          \w ==>[a-zA-Z0-9_],\W ==>[^a-zA-Z0-9_]
        //          \s ==>\t\h,'' ,\S ==>
        //座机号码验证：全国座机号码 两种格式：010-12345678 或者 0530-1234567
        //正则里面的或者 符号
        // var reg = /^\d{3}-\d{8}|\d{4}-\d{7}$/;
        var reg = /^\d{3,4}-\d{7,8}$/;
    </script>
</body>
</html>